package com.cskaoyan.controller.back;

import com.cskaoyan.bean.po.BasePageInfo;
import com.cskaoyan.bean.po.CommonData;
import com.cskaoyan.bean.po.User;
import com.cskaoyan.bean.vo.back.BaseRespVo;
import com.cskaoyan.exception.MarketValidationException;
import com.cskaoyan.service.back.UserService;
import com.cskaoyan.util.ValidationUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 管理用户控制器
 *
 * @author
 * @date 2022/06/25 11:05
 */
@RestController
@RequestMapping("admin/user")
public class AdminUserController {

    @Autowired
    UserService userService;
    @RequiresPermissions("admin:user:list")
    @RequestMapping("list")
    //public BaseRespVo list(String username, Integer page, Integer limit, String sort, String order) {
    public BaseRespVo list(String username, @Validated BasePageInfo info, BindingResult bindingResult) throws MarketValidationException {
        ValidationUtils.valid(bindingResult);
        CommonData<User> data =  userService.query(username,info);
        return BaseRespVo.ok(data);
    }



}
